﻿Imports System.IO

Public Class Principal
    Dim url_Servidor As String = "l"
    Dim obje As Libreria
    Public Sub New()
        InitializeComponent()
        obje = New Libreria()
        obje.Acceder_Conf()
        obje.cargar_conf()
        url_Servidor = obje.getUrl_Servidor()
        Console.WriteLine(" serv " & url_Servidor)
        If url_Servidor.Contains(".mdb") Then
            MenuCompactar.Enabled = True
        End If

    End Sub

    Private Sub ModificarToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ModificarToolStripMenuItem.Click
        Dim moda As New Modificar(url_Servidor, obje)
        moda.Show()
    End Sub

    Private Sub ConsultarYTalVesEliminarToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ConsultarYTalVesEliminarToolStripMenuItem.Click
        Dim consulta As New Consultar(url_Servidor, obje)
        consulta.Show()
    End Sub

    Private Sub AgregarUsuariosToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AgregarUsuariosToolStripMenuItem.Click
        Dim agre As New Agregar(url_Servidor, obje)
        agre.Show()
    End Sub

    Private Sub SalirToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SalirToolStripMenuItem.Click
        End
    End Sub

    Private Sub CompactarToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuCompactar.Click
        Dim u As String = "C:/Program Files/Microsoft Office/Office14/"
        Dim comando As String = u & "msaccess.exe /compact " & "" & url_Servidor & ""
        Console.WriteLine("controla " & Configuracion.Default.CONTROLADOR)
        Try

        Catch ex As IOException
            Console.WriteLine(ex.Message)
        End Try
    End Sub

    Private Sub AcercaDeToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AcercaDeToolStripMenuItem.Click
        Dim obj As New Acerca
        obj.Show()
    End Sub
End Class
